<template>
  <div class="container" @click="wrapClick">
    <div class="wrapper">
      <swiper class="swiper_container" :options="swiperOption" v-if="imgList">
        <swiper-slide v-for="(item, index) of imgList" :key="index">
          <img class="swiperImg" :src="item" />
        </swiper-slide>
        <div class="swiper-pagination" slot="pagination"></div>
      </swiper>
    </div>
  </div>
</template>

<script>
export default {
  name: 'CptGallary',
  props: {
    imgList: {
      type: [Array],
      required: true
    }
  },
  data () {
    return {
      swiperOption: {
        pagination: {
          el: '.swiper-pagination',
          type: 'fraction'
        },
        observer: true,
        observeParents: true
      }
    }
  },
  methods: {
    wrapClick: function () {
      this.$emit('close')
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="stylus" scoped>
.container{
  display flex
  width 100%
  height 100%
  top 0
  flex-direction column
  justify-content center
  z-index 99
  position fixed
  background #000
  .wrapper{
    background #fff
    width 100%
    height 100vw
    .swiper-container{
      width 100%
      height 100%
      overflow inherit
      .swiperImg{
        width 100%
        height 100%
      }
      .swiper-pagination-fraction{
        color #fff
        bottom -1rem
      }
    }
  }
}
</style>
